//审核用户，分配权限
function chargenode(id){
	var url = "frontend/chargedep.asp?x=1&y="+id+"&timestamp="+ new Date().getTime();
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange1;
    xmlHttp.open("get",url,true);
    xmlHttp.send(null);
	document.all.topoperation.innerHTML = "权限";
}

//更改单位管理员
function changemaster(depid,id){
	var url = "backend/changemaster.asp?id="+id+"&depid="+depid+"&timestamp="+ new Date().getTime();
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange6;
    xmlHttp.open("get",url,true);
    xmlHttp.send(null);
}
function handleStateChange6() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
			var ajaxRequestObj = xmlHttp.responseText;
			var rootid = ajaxRequestObj.split("|");
			chargenode(rootid[0]);
			showmsg('a','权限操作最后结果','修改管理员成功！<br>把<b>['+rootid[1]+']</b>设置为<br><b>['+rootid[2]+']</b>的管理员');
        }
    }
}
//查看权限
function changepop(id){
	var url = "frontend/changepop.asp?id="+id+"&timestamp="+ new Date().getTime();
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange7;
    xmlHttp.open("get",url,true);
    xmlHttp.send(null);
}
function handleStateChange7() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
			var ajaxRequestObj = xmlHttp.responseText;
			var detailLayer = document.getElementById("detailLayer");
			var table = detailLayer.getElementsByTagName("table");
			detailLayer.innerHTML = "<table width=98%  border=0 align=center cellpadding=5 cellspacing=1 style='margin-top:12px;'>"+table[0].innerHTML+"</table>"+ajaxRequestObj;
        }
    }
}
//更改部委管理员
function changeadmin(depid,id){
	var url = "backend/changeadmin.asp?id="+id+"&depid="+depid+"&timestamp="+ new Date().getTime();
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange8;
    xmlHttp.open("get",url,true);
    xmlHttp.send(null);
}
function handleStateChange8() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
			var ajaxRequestObj = xmlHttp.responseText;
			var rootid = ajaxRequestObj.split("|");
			chargenode(rootid[0]);
			showmsg('a','权限操作最后结果','增加部委管理员成功！<br>把<b>['+rootid[1]+']</b>设置为<br><b>['+rootid[3]+']</b>的管理员');
        }
    }
}
//取消单位管理员
function unmaster(depid,id){
	var url = "backend/unmaster.asp?id="+id+"&depid="+depid+"&timestamp="+ new Date().getTime();
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange9;
    xmlHttp.open("get",url,true);
    xmlHttp.send(null);
}
function handleStateChange9() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
			var ajaxRequestObj = xmlHttp.responseText;
			var rootid = ajaxRequestObj.split("|");
			chargenode(rootid[0]);
			showmsg('a','权限操作最后结果','撤销单位管理员成功！<br>撤销<b>['+rootid[1]+']</b><br><b>['+rootid[2]+']</b>管理员权限');
        }
    }
}
//取消部委管理员
function unadmin(depid,id){
	var url = "backend/unadmin.asp?id="+id+"&depid="+depid+"&timestamp="+ new Date().getTime();
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleunadminStateChange;
    xmlHttp.open("get",url,true);
    xmlHttp.send(null);
}
function handleunadminStateChange() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
			var ajaxRequestObj = xmlHttp.responseText;
			var rootid = ajaxRequestObj.split("|");
			chargenode(rootid[0]);
			showmsg('a','权限操作最后结果','撤销部委管理员成功！<br>撤销<b>['+rootid[1]+']</b><br><b>['+rootid[2]+']</b>管理员权限');
        }
    }
}